package shiyantian;

public class ZeroTest {
	
	public static int[] zeroFilter(int []a){
		
		boolean delFlag = false;
		
		int[] c = new int[a.length];
		int cIndex = 0;
		
		for(int i=0;i<a.length;i++)
		{
			if(a[i]==0 && i+1<a.length && a[i+1]==0)
			{
				delFlag = true;
				i++;
				continue;
			}
			if(a[i]==0 && delFlag)
			{
				continue;
			}
			
			c[cIndex++] = a[i];
			delFlag = false;
		}
		
		int[] r = new int[cIndex];
		for(int i=0;i<r.length;i++){
			r[i] = c[i];
		}
		return r;
	}

	public static void main(String[] args){

		System.out.println('\u0912');
		
		int a[] = {1,0,4,0,0,2,0,0,0,3,0,0,0,0,5,0};
		int r[] = zeroFilter(a);
		for(int i=0;i<a.length;i++)
		{
			System.out.print(a[i]+" ");
		}
		System.out.println("");
		for(int i=0;i<r.length;i++)
		{
			System.out.print(r[i]+" ");
		}
		
		System.out.println((int)'a');
	}
}